Skip to content

Promote CustomTestReflectable to API.#1686

Merged
grynspan merged 1 commit intomainfrom
jgrynspan/customtestreflectable-api
Apr 23, 2026
Merged

Promote CustomTestReflectable to API.#1686
grynspan merged 1 commit intomainfrom
jgrynspan/customtestreflectable-api

Conversation

@grynspan
Copy link
Copy Markdown
Contributor

Per ST-0022, promote this interface to API.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added this to the Swift 6.4.0 (main) milestone Apr 22, 2026
@grynspan grynspan self-assigned this Apr 22, 2026
@grynspan grynspan added enhancement New feature or request public-api Affects public API issue-handling Related to Issue handling within the testing library labels Apr 22, 2026

- ``Expectation``
- ``ExpectationFailedError``
- ``CustomTestStringConvertible``
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we unable to maintain this symbol reference here too? Ideally I think I'd like to be able to link to both this existing protocol and the new CustomTestReflectable from multiple places, but does DocC disallow that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can but I think we're only supposed to put it under one heading?

the description of a value _during testing only_. Values whose types conform to
this protocol use it to describe themselves when the testing library presents
them as part of the output of a test. For example, this protocol affects the
display of values you pass as arguments to test functions or that are elements
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"elements" feels like a confusing word in this position. "…or that are sub-expressions of…" perhaps?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither's a great choice but I'm not sure what exactly to put.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"…or that are included in an expectation." sounds good to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be the passive voice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"…or that you include in an expectation." ?


import FoodTruck

extension Food: CustomTestStringConvertible, CustomTestReflectable {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these typically need @retroactive too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because they'll be in the same package/project.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. Although it's not always the case that a test target is within a project which specifies a package name. For example, in Xcode projects you can specify a package identifier, but not all projects have adopted that feature. Since you have a - Note: callout at the end, consider mentioning that possibility there

Copy link
Copy Markdown
Contributor Author

@grynspan grynspan Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to phrase it exactly. "If that doesn't work, try internal, @testable, and @retroactive" sounds a bit hammer-headed.

@grynspan
Copy link
Copy Markdown
Contributor Author

Let's plan to revisit the documentation tweaks with our DevPubs friends.

@grynspan grynspan merged commit 8a4f3ad into main Apr 23, 2026
35 checks passed
@grynspan grynspan deleted the jgrynspan/customtestreflectable-api branch April 23, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request issue-handling Related to Issue handling within the testing library public-api Affects public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants